const path = require('path');
const webpack = require('webpack');
const ROOT = process.cwd();

module.exports = {
  // entry: {
  //   polyfill: ['babel-polyfill'],
  //   main: './src/index.js'
  // },
  context: ROOT,

  // entry: ['babel-polyfill','./src/index.js'], // support Promise/WeakMap/Arrya.from/generator functions
  entry: './src/index.jsx', // support Promise/WeakMap/Arrya.from/generator functions

  output: {
    filename: 'bundle.js',// entry 文件命名
    // chunkFileName: '[name].[chunkhash:6].js', // 非entry文件命名
    path: path.resolve(ROOT, 'dist')
  },

  module: {
    // noParse: ['node_modules'],
    rules: [{
      test: /\.jsx?/,
      exclude: /node_modules/,
      use: ['babel-loader']
      // rules:[] // nested rules
    }]
  },

  // plugins: [
  //   // 用于设置编译时的全局常量
  //   new webpack.DefinePlugin({
  //     'process.env.NODE_ENV': JSON.stringify('production')
  //   }),
  //   new webpack.optimize.UglifyJsPlugin()
  // ]
  
}